package com.budwk.app.sqfw.controllers.admin.datamange;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.budwk.app.sqfw.services.datamange.DataMangePersonService;
import com.budwk.app.sqfw.vo.SqfwDataMangePersonVO;
import com.budwk.starter.common.openapi.annotation.ApiDefinition;
import com.budwk.starter.common.openapi.annotation.ApiOperation;
import com.budwk.starter.common.openapi.annotation.ApiResponses;
import com.budwk.starter.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.*;

/**
 * @BelongsProject: dfxy-shequ
 * @Author: yangweimin
 * @CreateTime: 2024-07-04  11:45
 * @Description: TODO
 */
@IocBean
@At("/platform/sqfw/datamangePerson")
@ApiDefinition(tag = "人员信息")
@Slf4j
public class DataMangePersonController {
    @Inject
    private DataMangePersonService dataMangePersonService;

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "数据清洗")
    @ApiResponses
    //@SaCheckLogin
    public Result<?> dataCleaning(@Param("start") String start, @Param("end") String end) {
        dataMangePersonService.dataCleaning(start,  end);
        return Result.success();
    }

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "添加表头，若存在就更新")
    @ApiResponses
    @SaCheckLogin
    public Result<?> addHeader() {
        dataMangePersonService.addHeader();
        return Result.success();
    }

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "列表")
    @ApiResponses
    @SaCheckLogin
    public Result<?> page(@Param("..") SqfwDataMangePersonVO bean) {
        return Result.data(dataMangePersonService.page(bean));
    }

    @At()
    @Ok("json")
    @GET
    @ApiOperation(name = "获取用户所属区域")
    @SaCheckLogin
    public Result<?> getRegion() {
        return Result.data(dataMangePersonService.getRegion());
    }

    @At()
    @Ok("json")
    @GET
    @ApiOperation(name = "获取子单位")
    @SaCheckLogin
    public Result<?> getChild(@Param("id") String id) {
        return Result.data(dataMangePersonService.getChild(id));
    }

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "获取户籍所在地")
    @ApiResponses
    @SaCheckLogin
    public Result<?> getRegAddress(@Param("type") String type, @Param("parent") String parent) {
        return Result.data(dataMangePersonService.getRegAddress(type, parent));
    }

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "获取健康状态")
    @ApiResponses
    @SaCheckLogin
    public Result<?> getHealthStatus() {
        return Result.data(dataMangePersonService.getHealthStatus());
    }

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "获取特殊人员标签")
    @ApiResponses
    @SaCheckLogin
    public Result<?> getSpecialType() {
        return Result.data(dataMangePersonService.getSpecialType());
    }

}
